package com.devplatform.mapper.article;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.pojo.dto.ArticleAttachmentDto;
import com.devplatform.pojo.dto.ArticleDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface ArticleDtoMapper {
    Page<ArticleDto> selectArticleList(Page<ArticleDto> page);

    Page<ArticleDto> searchArticles(@Param("page") Page<ArticleDto> page, @Param("params") Map<String, Object> params);

    Page<ArticleDto> filterArticles(@Param("page") Page<ArticleDto> page, @Param("params") Map<String, Object> params);

    Page<ArticleDto> recommendHotArticles(@Param("page") Page<ArticleDto> page, @Param(Constants.WRAPPER) QueryWrapper wrapper);

    List<ArticleDto> selectHotTop100Articles(String categoryName);

    //查询文章详情、作者信息
    ArticleDto selectArticleDetails(@Param("authorId") Long authorId, @Param("articleId") Long articleId);

    //统计作者文章数
    int countArticlesByAuthorId(@Param("authorId") Long authorId);

    // 新增：查询文章的所有附件
    List<ArticleAttachmentDto> selectAttachmentsByArticleId(Long articleId);
}
